package com.szq.yygh.hosp.controller;

import com.szq.yygh.common.result.Result;
import com.szq.yygh.hosp.model.hosp.Hospital;
import com.szq.yygh.hosp.service.HospitalService;
import com.szq.yygh.hosp.vo.hosp.HospitalQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/***
 * All rights Reserved, Designed By www.jx-lab.com
 * @Title: HospitalController
 * @Description:
 * @author lixy
 * @date 2021/8/20 10:39
 * @version V1.0
 * @Copyright: www.jx-lab.com Inc. All rights reserved.
 * 注意：本内容仅限于众合景轩信息技术有限公司内部传阅，禁止外泄以及用于其他的商业目
 */
@Api(tags = "医院管理")
@RestController
@RequestMapping("/admin/hosp/hospital")
public class HospitalController {

    @Autowired
    private HospitalService hospitalService;

    @ApiOperation(value = "分页查询医院列表")
    @GetMapping("/list/{page}/{limit}")
    public Result listHosp(@PathVariable Integer page, @PathVariable Integer limit,
                           HospitalQueryVo hospitalQueryVo){
        Page<Hospital> pageResult = hospitalService.listHosp(page, limit, hospitalQueryVo);
        return Result.ok(pageResult);
    }

    @ApiOperation(value = "更新医院状态")
    @GetMapping("/updateHospStatus/{id}/{status}")
    public Result updateHospStatus(@PathVariable String id, @PathVariable Integer status){
        hospitalService.updateHospStatus(id, status);
        return Result.ok();
    }

    @ApiOperation(value = "医院信息")
    @GetMapping("/getHospitalById/{id}")
    public Result getHospitalById(@PathVariable String id){
        Map<String, Object> hospital = hospitalService.getHospitalById(id);
        return Result.ok(hospital);
    }
}
